{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "plt.rcParams['font.sans-serif']=['SimHei'] #用来正常显示中文标签\n",
    "plt.rcParams['axes.unicode_minus']=False #用来正常显示负号"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 426,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>面积</th>\n",
       "      <th>房间数</th>\n",
       "      <th>价格</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.130010</td>\n",
       "      <td>-0.223675</td>\n",
       "      <td>0.475747</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-0.504190</td>\n",
       "      <td>-0.223675</td>\n",
       "      <td>-0.084074</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.502476</td>\n",
       "      <td>-0.223675</td>\n",
       "      <td>0.228626</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>-0.735723</td>\n",
       "      <td>-1.537767</td>\n",
       "      <td>-0.867025</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1.257476</td>\n",
       "      <td>1.090417</td>\n",
       "      <td>1.595389</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>-0.019732</td>\n",
       "      <td>1.090417</td>\n",
       "      <td>-0.323998</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>-0.587240</td>\n",
       "      <td>-0.223675</td>\n",
       "      <td>-0.204036</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>-0.721881</td>\n",
       "      <td>-0.223675</td>\n",
       "      <td>-1.130948</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>-0.781023</td>\n",
       "      <td>-0.223675</td>\n",
       "      <td>-1.026973</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>-0.637573</td>\n",
       "      <td>-0.223675</td>\n",
       "      <td>-0.783051</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         面积       房间数        价格\n",
       "0  0.130010 -0.223675  0.475747\n",
       "1 -0.504190 -0.223675 -0.084074\n",
       "2  0.502476 -0.223675  0.228626\n",
       "3 -0.735723 -1.537767 -0.867025\n",
       "4  1.257476  1.090417  1.595389\n",
       "5 -0.019732  1.090417 -0.323998\n",
       "6 -0.587240 -0.223675 -0.204036\n",
       "7 -0.721881 -0.223675 -1.130948\n",
       "8 -0.781023 -0.223675 -1.026973\n",
       "9 -0.637573 -0.223675 -0.783051"
      ]
     },
     "execution_count": 426,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dataset1 = pd.read_csv('./dataset2.csv')\n",
    "# 数据归一化操作\n",
    "dataset1 = (dataset1 - dataset1.mean())/dataset1.std()\n",
    "dataset1.head(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 427,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>面积</th>\n",
       "      <th>房间数</th>\n",
       "      <th>价格</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>4.700000e+01</td>\n",
       "      <td>4.700000e+01</td>\n",
       "      <td>4.700000e+01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>3.779483e-17</td>\n",
       "      <td>2.746030e-16</td>\n",
       "      <td>-9.684924e-17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>1.000000e+00</td>\n",
       "      <td>1.000000e+00</td>\n",
       "      <td>1.000000e+00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>-1.445423e+00</td>\n",
       "      <td>-2.851859e+00</td>\n",
       "      <td>-1.363666e+00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>-7.155897e-01</td>\n",
       "      <td>-2.236752e-01</td>\n",
       "      <td>-7.238702e-01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>-1.417900e-01</td>\n",
       "      <td>-2.236752e-01</td>\n",
       "      <td>-3.239979e-01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>3.376348e-01</td>\n",
       "      <td>1.090417e+00</td>\n",
       "      <td>3.521863e-01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>3.117292e+00</td>\n",
       "      <td>2.404508e+00</td>\n",
       "      <td>2.874981e+00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                 面积           房间数            价格\n",
       "count  4.700000e+01  4.700000e+01  4.700000e+01\n",
       "mean   3.779483e-17  2.746030e-16 -9.684924e-17\n",
       "std    1.000000e+00  1.000000e+00  1.000000e+00\n",
       "min   -1.445423e+00 -2.851859e+00 -1.363666e+00\n",
       "25%   -7.155897e-01 -2.236752e-01 -7.238702e-01\n",
       "50%   -1.417900e-01 -2.236752e-01 -3.239979e-01\n",
       "75%    3.376348e-01  1.090417e+00  3.521863e-01\n",
       "max    3.117292e+00  2.404508e+00  2.874981e+00"
      ]
     },
     "execution_count": 427,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dataset1.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 397,
   "metadata": {},
   "outputs": [],
   "source": [
    "# plt.figure()\n",
    "# plt.scatter(dataset1['人口'],dataset1['收益'])\n",
    "# plt.xlabel('人口')\n",
    "# plt.ylabel('收益')\n",
    "# plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 428,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 在第一列加入 1，表示偏移 b 的系数为 1\n",
    "dataset1.insert(0,'ones',1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 429,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ones</th>\n",
       "      <th>面积</th>\n",
       "      <th>房间数</th>\n",
       "      <th>价格</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0.130010</td>\n",
       "      <td>-0.223675</td>\n",
       "      <td>0.475747</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>-0.504190</td>\n",
       "      <td>-0.223675</td>\n",
       "      <td>-0.084074</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>0.502476</td>\n",
       "      <td>-0.223675</td>\n",
       "      <td>0.228626</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>-0.735723</td>\n",
       "      <td>-1.537767</td>\n",
       "      <td>-0.867025</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>1.257476</td>\n",
       "      <td>1.090417</td>\n",
       "      <td>1.595389</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>1</td>\n",
       "      <td>-0.019732</td>\n",
       "      <td>1.090417</td>\n",
       "      <td>-0.323998</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>1</td>\n",
       "      <td>-0.587240</td>\n",
       "      <td>-0.223675</td>\n",
       "      <td>-0.204036</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>1</td>\n",
       "      <td>-0.721881</td>\n",
       "      <td>-0.223675</td>\n",
       "      <td>-1.130948</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>1</td>\n",
       "      <td>-0.781023</td>\n",
       "      <td>-0.223675</td>\n",
       "      <td>-1.026973</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>1</td>\n",
       "      <td>-0.637573</td>\n",
       "      <td>-0.223675</td>\n",
       "      <td>-0.783051</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   ones        面积       房间数        价格\n",
       "0     1  0.130010 -0.223675  0.475747\n",
       "1     1 -0.504190 -0.223675 -0.084074\n",
       "2     1  0.502476 -0.223675  0.228626\n",
       "3     1 -0.735723 -1.537767 -0.867025\n",
       "4     1  1.257476  1.090417  1.595389\n",
       "5     1 -0.019732  1.090417 -0.323998\n",
       "6     1 -0.587240 -0.223675 -0.204036\n",
       "7     1 -0.721881 -0.223675 -1.130948\n",
       "8     1 -0.781023 -0.223675 -1.026973\n",
       "9     1 -0.637573 -0.223675 -0.783051"
      ]
     },
     "execution_count": 429,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dataset1.head(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 430,
   "metadata": {},
   "outputs": [],
   "source": [
    "X = dataset1.iloc[:,:-1]\n",
    "Y = dataset1.iloc[:,-1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 431,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ones</th>\n",
       "      <th>面积</th>\n",
       "      <th>房间数</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0.130010</td>\n",
       "      <td>-0.223675</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>-0.504190</td>\n",
       "      <td>-0.223675</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>0.502476</td>\n",
       "      <td>-0.223675</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>-0.735723</td>\n",
       "      <td>-1.537767</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>1.257476</td>\n",
       "      <td>1.090417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>1</td>\n",
       "      <td>-0.019732</td>\n",
       "      <td>1.090417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>1</td>\n",
       "      <td>-0.587240</td>\n",
       "      <td>-0.223675</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>1</td>\n",
       "      <td>-0.721881</td>\n",
       "      <td>-0.223675</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>1</td>\n",
       "      <td>-0.781023</td>\n",
       "      <td>-0.223675</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>1</td>\n",
       "      <td>-0.637573</td>\n",
       "      <td>-0.223675</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   ones        面积       房间数\n",
       "0     1  0.130010 -0.223675\n",
       "1     1 -0.504190 -0.223675\n",
       "2     1  0.502476 -0.223675\n",
       "3     1 -0.735723 -1.537767\n",
       "4     1  1.257476  1.090417\n",
       "5     1 -0.019732  1.090417\n",
       "6     1 -0.587240 -0.223675\n",
       "7     1 -0.721881 -0.223675\n",
       "8     1 -0.781023 -0.223675\n",
       "9     1 -0.637573 -0.223675"
      ]
     },
     "execution_count": 431,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X.head(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 432,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    0.475747\n",
       "1   -0.084074\n",
       "2    0.228626\n",
       "3   -0.867025\n",
       "4    1.595389\n",
       "Name: 价格, dtype: float64"
      ]
     },
     "execution_count": 432,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Y.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 433,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0., 0., 0.])"
      ]
     },
     "execution_count": 433,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x_train = np.array(X.values)\n",
    "y_train = np.array(Y.values).reshape(-1,1)\n",
    "w = np.zeros(x_train.shape[1])\n",
    "w"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 434,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "((47, 3), (47, 1), (3,))"
      ]
     },
     "execution_count": 434,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x_train.shape,y_train.shape,w.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 436,
   "metadata": {},
   "outputs": [],
   "source": [
    "a = 0.01\n",
    "iters = 1000"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 437,
   "metadata": {},
   "outputs": [],
   "source": [
    "def count_loss(x,y,w):    \n",
    "    temp = np.power(np.dot(x,w.reshape(-1,1)) - y,2)\n",
    "    return np.sum(temp)/(2 * x.shape[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 438,
   "metadata": {},
   "outputs": [],
   "source": [
    "def gradient_decent(x,y,w,a,iters):\n",
    "#     temp_w = np.matrix(np.zeros(w.shape))\n",
    "    costs = []\n",
    "    for i in range(iters):\n",
    "        temp = np.dot(x,w.reshape(-1,1)) - y\n",
    "        for param in range(w.shape[0]):\n",
    "            sum_ = np.sum(np.multiply(temp, x[:,param].reshape(-1,1)))\n",
    "            w[param] = w[param] - (a/x.shape[0]) * sum_\n",
    "        costs.append(count_loss(x,y,w))\n",
    "    return costs,w           "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 439,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([-1.10910099e-16,  8.78503652e-01, -4.69166570e-02])"
      ]
     },
     "execution_count": 439,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "w_ = np.array([i for i in w])\n",
    "costs,w_new = gradient_decent(x_train,y_train,w_,a,iters)\n",
    "w_new"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 393,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAEDCAYAAAA2k7/eAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAqw0lEQVR4nO3deXxU9b3/8dc3k0BCCGELYAJhC4ssIhIVRARiKw+XulVrrV67XH9qrdjtch96a1u9t95ivfbegihVaxdtrdQq2lpLlSTIqoBBkComhBASQNawZSHL9/fHzMAkmZlMktnn/Xw8eDiZOTPnM8fkPWe+53O+x1hrERGR+JcU6QJERCQ8FPgiIglCgS8ikiAU+CIiCUKBLyKSIJIjXYAvAwcOtCNGjIh0GSIiMWXz5s2HrLVZ3h4LSeAbYzKBP7pe/yRwC1AGlLsWmW+t3ebvNUaMGMGmTZtCUZ6ISNwyxuz29ViohnRuA35urf08sB94AHjJWjvH9c9v2IuISPCFZA/fWvuUx49ZwB7gBmPMTGA38FVrbVMo1i0iIt6F9KCtMWYG0A94G5htrb0UqAGu8rH8XcaYTcaYTQcPHgxlaSIiCSdkgW+M6Q8sBr4BbLXW7nM99AkwxttzrLXPWGvzrbX5WVlejzmIiEgXhSTwjTE9gGXAg9ba3cALxpgp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"<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure()\n",
    "\n",
    "x = np.linspace(5,23)\n",
    "y = w_new[1] * x + w_new[0]\n",
    "\n",
    "plt.plot(x,y)\n",
    "plt.scatter(dataset1['人口'],dataset1['收益'])\n",
    "plt.xlabel('人口')\n",
    "plt.ylabel('收益')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 训练次数与loss的曲线图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 441,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXgAAAD2CAYAAADcUJy6AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAcJklEQVR4nO3dfXRc9Z3f8fd3nvT8aI1lJIwdg4FgjAkIAsaAN8EJUFKKzxZIs5CzCaVJ6faE/tGQE5qebsl2S7NssjkhqTfe3RSSFG9b2OwCCbjGYGrMIh+eDNiYBxtjW1i2ZUuyrOdv/5g7tixL1sgaaaR7P69zJvObe39X8/0J5zM//ebOHXN3REQkfGKFLkBERCaHAl5EJKQU8CIiIaWAFxEJKQW8iEhIJQpdQFZdXZ3Pnz+/0GWIiMwomzdv3u/u6ZH2TZuAnz9/Ps3NzYUuQ0RkRjGznaPt0xKNiEhIKeBFREJKAS8iElIKeBGRkFLAi4iElAJeRCSkFPAiIiE14wN+z6GjPPTMNj7cf6TQpYiITCszPuAPHunlL9a9x7ufdBS6FBGRaWXGB3xVSRKAw0f7ClyJiMj0MuMDvjII+HYFvIjICWZ8wFcUJTDTDF5EZLgZH/CxmFFVklTAi4gMM+MDHlDAi4iMQAEvIhJSCngRkZAKRcBXliQ53KWAFxEZKhQBrxm8iMjJQ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Bb4MfA1Rh5v2H4H9wE/cfdDweMojPkzwCp3bwEeBV4g/GP+E+Ab7v7HZAL+XxD+MWfl+m96wuOf6b+wzRz/s20JsKNwpeRfMJtdA3zH3Xcy8njD9ju4DrjHzNYDFwNfIvxjfg9YELSbyCxXhH3MpcBiM4sDnwX+lPCPOSvX/x9PePyJ069xWngC2GBmDcANwBWFLSfvvg5cCnzXzL4L/DVwx7DxOiH6Hbj7Ndl2EPL/lJPHF6oxA6uBvzKz24EkmbXX34R8zP+FzL/necBLwJ8T/v/OWb8AngreWL8AeJnMUkwu28Zlxn+SNXiHegXwQvAnbqiNNN6w/w40Zo2ZkI05eNFaBvwuuz6f67ZxPc9MD3gRERnZTF+DFxGRUSjgRURCSgEvIhJSCngRkZBSwIuIhNT/B8wzQf9KZBjwAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure()\n",
    "x = np.arange(0,1000,1)\n",
    "plt.plot(x,costs)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 最小二乘法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 453,
   "metadata": {},
   "outputs": [],
   "source": [
    "x_matrix = np.matrix(X.values)\n",
    "y_matrix = np.matrix(Y.values).reshape(-1,1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 454,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "((47, 3), (47, 1))"
      ]
     },
     "execution_count": 454,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x_matrix.shape,y_matrix.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 455,
   "metadata": {},
   "outputs": [],
   "source": [
    "def lsm(x,y):\n",
    "    return np.dot(np.linalg.inv(np.dot(x.T, x)),np.dot(x.T, y))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 456,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "matrix([[-8.19424759e-17],\n",
       "        [ 8.84765988e-01],\n",
       "        [-5.31788197e-02]])"
      ]
     },
     "execution_count": 456,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "w_lsm = lsm(x_matrix,y_matrix)\n",
    "w_lsm"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
